<?php

namespace App\Http\Requests\API;

use App\Models\Device;
use InfyOm\Generator\Request\APIRequest;

class UpdateDeviceAPIRequest extends APIRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'name' => 'string|max:64',
            'ip' => 'max:64',
            'type' => 'integer',
            'brand'=>'integer',
            'spec'=>'integer',
            'park_code' => 'integer',
            'channel_id'=>'integer',
            'buy_time'=>'date',
            'use_time'=>'date',
            'device_id'=>'string|unique:devices,device_id,'.$this->route('device'),
        ];
    }
}
